package controller;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import utils.Mensaje;

import com.mxgraph.swing.mxGraphComponent;


public class ManagerExportar extends JDialog{

	public void capturarPantalla(String directorioActual, String fileName, mxGraphComponent areaDeImpresion)
			throws Exception {
		BufferedImage bi = new BufferedImage(areaDeImpresion.getViewport().getWidth(), areaDeImpresion.getViewport()
				.getHeight(), BufferedImage.TYPE_INT_ARGB);
		Graphics g = bi.createGraphics();
		areaDeImpresion.getViewport().paint(g);
		g.dispose();
			
		ImageIO.write(bi, "png", new File(directorioActual,fileName + ".jpg"));
		
		JOptionPane.showMessageDialog(this,Mensaje.EXPORTACION_CORRECTA, "",
                JOptionPane.INFORMATION_MESSAGE);
					
	}
}
